﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.HTML
{
    public class HTMLTableCaptionElement : HTMLBlockBaseElement
    {
        #region Constructors

        internal HTMLTableCaptionElement(Document owner)
            : base(owner, HTMLConstants.HTML_TAG_TABLECAPTION)
        {
        }

        #endregion

        #region Custom Attributes

        /// <summary>
        /// Returns the containing table element or null if unattached.
        /// </summary>
        public HTMLTableElement tableElement
        {
            get
            {
                HTMLElement p = this;

                do
                {
                    p = p.Parent as HTMLElement;
                }
                while ((p != null) && !(p is HTMLTableElement));

                return (p != null ? p as HTMLTableElement : null);

            }
        }

        #endregion
    }
}
